#ifndef _ORACLEUTIL_HPP	
#define _ORACLEUTIL_HPP
#include "occienv.hpp"
#include <string>
#include <semaphore.h>
using std::string;
using namespace oracle::occi;

namespace com_oocl_riley {

    class OcciPool {
    public:
        OcciPool(const string& constr, const string& usr, const string& pwd, int maxCon = 10,int minCon=2,int incrCon=2);
        Connection *getConnection();
        void releaseConnection(Connection *);
        ~OcciPool();

        const string Constr() const {
            return _constr;
        }

        const string Usr() const {
            return _usr;
        }

        const string Pwd() const {
            return _pwd;
        }
    private:
        OcciPool(const OcciPool&);
        OcciPool &operator=(const OcciPool&);
    private:
        OcciEnv *_occiEnv;
        StatelessConnectionPool *_pool;
        string _constr;
        string _usr;
        string _pwd;
        int _maxCon;
        int _minCon;
        int _incrCon;
    private:
        sem_t _sem;
    };

}

#endif